<template>
	<view class="content">
	
		
	    <NewCards></NewCards>
		<CloudPrint v-show="currentPage==0" ref="printShop"></CloudPrint>
		<Order v-if="currentPage==1" ref="order" :resh="resh"></Order>


		<!-- 底部选择条 -->
		<view class="cu-bar tabbar bg-white shadow foot" style="background-color: white;">
			<view class="action " data-cur="basics" v-for="(item,index) in tabBar" @click="navTo(item,index)">
				<view class='cuIcon-cu-image text-bar'>
					<image class="animation-scale-up" :src="index== currentPage?item.imgClick:item.imgNormal"
						mode="aspectFit"></image>
				</view>
				<view :class="index== currentPage?'text-blue':'text-gray'" class="text-bar navFont">{{item.text}}</view>
			</view>
		</view>

	</view>
</template>

<script>
	import CloudPrint from './index/index.vue'
	import Order from './order/order.vue'

	export default {
		components: {
			CloudPrint,
			Order,
		},
		
		data() {
			return {
				
				currentPage: 0,
				title: "云打印",
				resh: false,
				tabBar: [{
						url: '/app/CloudPrint/pages/index/index',
						text: '打印',
						imgNormal: this.resDomain + '/TakeOut/static/cefimgs/foodindex_gray@2x.png',
						imgClick: this.resDomain + '/TakeOut/static/cefimgs/foodindex_blue@2x.png'
					},
					{
						url: '/app/CloudPrint/pages/user/orderList',
						text: '订单',
						imgNormal: this.resDomain + '/TakeOut/static/cefimgs/foodorder_gray@2x.png',
						imgClick: this.resDomain + '/TakeOut/static/cefimgs/foodorder_blue@2x.png'
					}
					
				]

			}
		},
		onShareAppMessage(res) {
			let dat = {
				params: '/app/TakeOut/pages/index',
				key: ""
			}
			return {
				title: "一舟校园-" + this.title,
				path: "/pages/basic/basic?param=" + JSON.stringify(dat),
			}

		},
		onShow() {
			this.upData();
			this.currentPage==1?this.$refs.order.update():"";
		},
		methods: {
			upDataLogin() {
				
				switch (this.currentPage) {
					case 3:
						this.$refs.user.load();
						break;
					case 2:
						this.$refs.complanit.load();
						break;
					case 1:
						//this.resh = true;
						let time = new Date().getTime(); //获取当前的毫秒数
						this.resh = time;
						break;

				}

			},
			selectShop(res){
				this.$refs.printShop.selectshop(res);
			},

			upData() {
				this.resh = false;
				switch (this.currentPage) {
					case 3:
						this.$refs.user.load();
						break;
					case 2:
						this.$refs.complanit.load();
						break;
					case 1:
						let time = new Date().getTime(); //获取当前的毫秒数
						this.resh = time;
						break;

				}
			},


			navTo(item, index) {
				this.currentPage = index;
				switch (index) {
					case 3:
						this.$refs.user.load();
						break;
					case 2:
						this.$refs.complanit.load();
						break;

				}

				var isUrl = `${item.url}`

			}
		}
	}
</script>
<style scoped>
	
	.navFont {
		font-size: 24upx;
	}
	.cuIcon-cu-image{
		display: flex;
		align-items: center;
	}
	.text-bar{
		line-height: 1;
	}
	.price{
		font-size: 24upx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FE4646;
	}
</style>
